Python Versions and Installation

Before starting to write Python programs, it is important to understand the different Python versions and how to install Python on your system.

Python versions and installations

1. Python Versions

Python 2 was widely used in the past, but it is no longer supported.
Python 3 is the latest and recommended version for all new projects.

Example difference:

Python 2:

print "Hello"

Python 3:

print("Hello")

Today, almost all companies and developers use Python 3.

2. Downloading Python

You can download Python from the official website:

Always download the latest stable version of Python 3.

3. Installing Python

After downloading:

  1. Open the installer file.
  2. Make sure to check the box "Add Python to PATH".
  3. Click "Install Now".
  4. Wait for the installation to complete.

Once installation is finished, Python is ready to use.

4. Checking Python Installation

To verify that Python is installed correctly:

  1. Open Command Prompt (Windows) or Terminal (macOS/Linux).
  2. Type:
              
                python --version
              
            

If Python is installed properly, it will display the installed version number.

Example output:

      
        Python 3.12.0
      
    

5. Running Your First Python Program

After installation, you can run Python in two ways:

Simple example:

print("Hello, World!")

When you run this program, it will display:

Hello, World!

This confirms that Python is working correctly.